package com.jsel;

import junit.framework.TestCase;

import org.xidea.el.Expression;
import org.xidea.el.ExpressionFactory;

import temp.StaticInnerTest;

public class JselTest extends TestCase{

	private ExpressionFactory factory = ExpressionFactory.getInstance();
	
	private Integer num = 100;
	/**
     * 表达式函数（与对象绑定时，可以不申明为　static）
     */
    public int testAdd(int i,int j){
        return i+j;
    }
    
    public void testExpression(){
        Expression el = factory.create("12 * 60 + 100");
        Object result1 = el.evaluate();
        System.out.println("result1");
        System.out.println(result1);
    }
    
    public void testFunction(){
    	Expression e = factory.create("testAdd(1,10) + num");
    	Object result = e.evaluate(this);
    	System.out.println(result);
//    	String s = "";
//    	s.getBytes()
//    	s.toString();
    }

	public Integer getNum() {
		return num;
	}

	public void setNum(Integer num) {
		this.num = num;
	}
}
